import * as types from './types'

export default {
  from (state = '杭州', action) {
    const { type, payload } = action;
    switch (type) {
      case types.SET_FROM:
        return payload;
      default:
    }

    return state;
  },

  to (state = '太原', action) {
    const { type, payload } = action;
    switch (type) {
      case types.SET_TO:
        return payload;
      default:
    }

    return state;
  },

  isCitySelectorVisible (state = false, action) {
    const { type, payload } = action;
    switch (type) {
      case types.SET_IS_CITY_SELECTOR_VISIBLE:
        return payload;
      default:
    }

    return state;
  },

  currentSelectingLeftCity (state = false, action) {
    const { type, payload } = action;
    switch (type) {
      case types.SET_CURRENT_SELECTING_LEFT_CITY:
        return payload;
      default:
    }

    return state;
  },

  cityData (state = null, action) {
    const { type, payload } = action;
    switch (type) {
      case types.SET_CITY_DATA:
        return payload;
      default:
    }

    return state;
  },

  isLoadingCityData (state = false, action) {
    const { type, payload } = action;
    switch (type) {
      case types.SET_IS_LOADING_CITY_DATA:
        return payload;
      default:
    }

    return state;
  },

  isDateSelectorVisible (state = false, action) {
    const { type, payload } = action;
    switch (type) {
      case types.SET_IS_DATE_SELECTOR_VISIBLE:
        return payload;
      default:
    }

    return state;
  },

  departDate (state = Date.now(), action) {
    const { type, payload } = action;
    switch (type) {
      case types.SET_DEPART_DATE:
        return payload;
      default:
    }

    return state;
  },

  highSpeed (state = false, action) {
    const { type, payload } = action;
    switch (type) {
      case types.SET_HIGH_SPEED:
        return payload;
      default:
    }

    return state;
  }
}